﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using BarCode.Common;
using BarCode.AccessDao;
using BarCode.Bean;
using LackCodePrint.Module;
using LackCodePrint.Common;
using System.Web;

namespace LackCodePrint
{


    public partial class MainForm : Form
    {
        private static readonly log4net.ILog LogUtil = log4net.LogManager.GetLogger(typeof(LackCodePrint));

        /// <summary>
        /// 客户信息字典
        /// </summary>
        private Dictionary<string, CustomerInfo> dicCustomer;

        public MainForm()
        {
            InitializeComponent();
        }

        private void printForm_Load(object sender, EventArgs e)
        {
            IniFileHelper.IniFile();
            // 读取MySql数据库信息
            GlobalVal.MysqlServerInfo = IniFileHelper.ReadMySqlAccessInfo("MySql");
            if (GlobalVal.MysqlServerInfo == null)
            {
                LogUtil.Error("数据库配置数据读取失败！");
                lblError.Text = "数据库配置读取失败！";
                return;
            }

            // 读取打印机信息
            //IniFileHelper.readPrinterName();
            //if (String.IsNullOrEmpty(GlobalVal.PrinterName))
            //{
               // lblError.Text = "请先到配置文件设置好打印机！";
               //this.Close();
            //}

            txtOrderNo.Text = "";
            gridBH.DataSource = null;
            
            lblError.Text = "请输入订单号查询表号范围";

            // 加载客户信息字典
            createCustomerInfo();

            cmbData.SelectedItem = "0";
            cmbLine.SelectedItem = "1";
        }

        /// <summary>
        /// 查询
        /// </summary>
        private void btnSearch_Click(object sender, EventArgs e)
        {
            DoSearch();
        }

        private void btnClear_Click(object sender, EventArgs e)
        {
            txtOrderNo.Text = "";
            lblError.Text = "";
            lblError.ForeColor = Color.Blue;
            clearGridData();
        }


        private void gridBH_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DataGridViewRow selectedRow = gridBH.SelectedRows[0];
                string startCode = Convert.ToString(selectedRow.Cells["meters_IDstart"].Value);
                string endCode = Convert.ToString(selectedRow.Cells["meters_IDend"].Value);

                double meters_tolmax = Convert.ToDouble(selectedRow.Cells["meters_tolmax"].Value);
                double meters_tolmin = Convert.ToDouble(selectedRow.Cells["meters_tolmin"].Value);

                int loopStart, loopEnd;

                int numCnt = 7;
                bool bStart = int.TryParse(startCode.Substring(startCode.Length - numCnt), out loopStart);
                if (!bStart)
                {
                    numCnt = 6;
                    bStart = int.TryParse(startCode.Substring(startCode.Length - numCnt), out loopStart);
                    if (!bStart)
                    {
                        numCnt = 5;
                        bStart = int.TryParse(startCode.Substring(startCode.Length - numCnt), out loopStart);
                        if (!bStart)
                        {
                            lblError.ForeColor = Color.Red;
                            lblError.Text = "起始表号转换错误";
                            return;
                        }
                    }
                }
                bool bEnd = int.TryParse(endCode.Substring(endCode.Length - numCnt), out loopEnd);
                if (!bEnd)
                {
                    lblError.ForeColor = Color.Red;
                    lblError.Text = "终止表号转换错误";
                    return;
                }

                LogUtil.Info("计算表号区间：" + loopStart + " ~ " + loopEnd);
                lblError.ForeColor = Color.Blue;
                Application.DoEvents();

                // 选择行的客户
                string customerName = Convert.ToString(selectedRow.Cells["customer_name"].Value);
                CustomerInfo selectedCustomer = null;
                if (dicCustomer.ContainsKey(customerName))
                {
                    selectedCustomer = dicCustomer[customerName];
                }
                else
                {
                    selectedCustomer = dicCustomer["普通"];
                }

                string tmpI = "";
                string tmpBH = "";
                int leaveCnt = 0;
                int unQualifiedCnt = 0;
                List<PackLeaveInfo> lstLeaveInfo = new List<PackLeaveInfo>();
                List<PackLeaveInfo> lstUnQualifiedInfo = new List<PackLeaveInfo>();
                DB02Dao db02 = new DB02Dao();
                Dictionary<String, String> lstUnQualifiedBH = null;
                //Dictionary<String, String> lstQualifiedBH = db02.getAllQualifiedBH(startCode, endCode, meters_tolmax, meters_tolmin, ref lstUnQualifiedBH);
                Dictionary<String, String> lstQualifiedBH = db02.getAllQualifiedBH(startCode, endCode, ref lstUnQualifiedBH);
                if (lstQualifiedBH == null)
                {
                    MessageUtil.Error("获取表号发生异常！请联系系统管理员！");
                    return;
                }
                for (int loopIdx = loopStart; loopIdx <= loopEnd; loopIdx++)
                {
                    Application.DoEvents();
                    tmpI = loopIdx.ToString().PadLeft(numCnt, '0');
                    lblError.Text = "已查询表号数量：" + Convert.ToString(loopIdx - loopStart + 1);

                    tmpBH = startCode.Substring(0, startCode.Length - numCnt) + tmpI;
                    if (!lstQualifiedBH.ContainsKey(tmpBH) && !lstUnQualifiedBH.ContainsKey(tmpBH))
                    {
                        leaveCnt++;
                        PackLeaveInfo tmpLeaveInfo = new PackLeaveInfo();
                        tmpLeaveInfo.No = leaveCnt;
                        tmpLeaveInfo.leaveBH = tmpBH;
                        lstLeaveInfo.Add(tmpLeaveInfo);
                    }
                }

                foreach(String tmpKey in lstUnQualifiedBH.Keys)
                {
                    unQualifiedCnt++;
                    PackLeaveInfo tmpUnQualifiedInfo = new PackLeaveInfo();
                    tmpUnQualifiedInfo.No = unQualifiedCnt;
                    tmpUnQualifiedInfo.leaveBH = tmpKey;
                    lstUnQualifiedInfo.Add(tmpUnQualifiedInfo);
                }

                LogUtil.Debug("缺号审核检索处理结束。");
                if (leaveCnt == 0 && unQualifiedCnt == 0)
                {
                    lblError.Text = "没有缺失表号和不合格的表号";
                    // 更新已测
                    DB01Dao db01 = new DB01Dao();
                    int ret = db01.completeTest(Convert.ToInt32(selectedRow.Cells["listID"].Value));
                    if (ret == Consts.RET_SUCCESS)
                    {
                        lblError.Text = "测试完毕";
                    }   
                }
                else
                {
                    frmPackLeave objLeaveForm = new frmPackLeave();
                    objLeaveForm.lstLeaveInfo = lstLeaveInfo;
                    objLeaveForm.lstUnQualifiedInfo = lstUnQualifiedInfo;
                    objLeaveForm.startCode = startCode;
                    objLeaveForm.selectedCustomer = selectedCustomer;
                    objLeaveForm.intDist = Convert.ToInt32(cmbData.SelectedItem);
                    objLeaveForm.extra = Convert.ToString(selectedRow.Cells["meter_precision"].Value);
                    objLeaveForm.Text = startCode + "～" + endCode + "范围缺失/不合格表号";
                    objLeaveForm.ShowDialog();
                }

                lblError.ForeColor = Color.Blue;

            }
            catch (Exception ex)
            {
                MessageUtil.Error(ex.Message);
            }
        }

        private void txtOrderNo_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)13)
            {
                DoSearch();
            }
        }

        private void gridBH_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            foreach (DataGridViewRow row in gridBH.Rows)
            {
                row.Cells[0].Value = row.Index + 1;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridBH_SelectionChanged(object sender, EventArgs e)
        {
            if (gridBH.SelectedRows.Count > 0)
            {
                DataGridViewRow selectedRow = gridBH.SelectedRows[0];
                string customerName = Convert.ToString(selectedRow.Cells["customer_name"].Value);
                if (dicCustomer.ContainsKey(customerName))
                {
                    cmbLine.SelectedItem = dicCustomer[customerName].printCnt.ToString();
                }
                else
                {
                    cmbLine.SelectedItem = "1";
                }
                
            }
        }


        private void DoSearch()
        {
            try
            {
                clearGridData();


                DB01Dao db01 = new DB01Dao();
                if (String.IsNullOrEmpty(txtOrderNo.Text))
                {
                    lblError.ForeColor = Color.Red;
                    lblError.Text = "请先输入订单号";
                    return;
                }
                DataTable dtBH = db01.selectOrderBHList(txtOrderNo.Text);
                if (dtBH == null || dtBH.Rows.Count == 0)
                {
                    lblError.ForeColor = Color.Red;
                    lblError.Text = "订单号对应的未测数据不存在";
                    return;
                }
                else
                {
                    gridBH.DataSource = dtBH;
                }

                lblError.Text = "请双击选择表号范围";
                lblError.ForeColor = Color.Blue;
            }
            catch (Exception ex)
            {
                MessageUtil.Error(ex.Message);
            }
        }

        private void clearGridData()
        {
            DataTable dt = gridBH.DataSource as DataTable;
            if (dt != null)
            {
                dt.Rows.Clear();
                gridBH.DataSource = dt;
            }              
        }

        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (gridBH.SelectedRows.Count != 1)
            {
                MessageUtil.Error("请先选择一条数据！");
                return;
            }

            DataGridViewRow selectedRow = gridBH.SelectedRows[0];

            string startCode = Convert.ToString(selectedRow.Cells["meters_IDstart"].Value);
            string endCode = Convert.ToString(selectedRow.Cells["meters_IDend"].Value);

            int loopStart, loopEnd;

            int numCnt = 6;
            bool bStart = int.TryParse(startCode.Substring(startCode.Length - numCnt), out loopStart);
            if (!bStart)
            {
                numCnt = 5;
                bStart = int.TryParse(startCode.Substring(startCode.Length - numCnt), out loopStart);
                if (!bStart)
                {
                    lblError.ForeColor = Color.Red;
                    lblError.Text = "起始表号转换错误";
                    return;
                }
            }
            bool bEnd = int.TryParse(endCode.Substring(endCode.Length - numCnt), out loopEnd);
            if (!bEnd)
            {
                lblError.ForeColor = Color.Red;
                lblError.Text = "终止表号转换错误";
                return;
            }
            lblError.ForeColor = Color.Blue;
            Application.DoEvents();

            // 选择行的客户
            string customerName = Convert.ToString(selectedRow.Cells["customer_name"].Value);
            CustomerInfo selectedCustomer = null;
            if (dicCustomer.ContainsKey(customerName))
            {
                selectedCustomer = dicCustomer[customerName];
            }
            else
            {
                selectedCustomer = dicCustomer["普通"];
            }
            Console.WriteLine(loopEnd + "---------" + loopStart);
            int pageCnt = loopEnd - loopStart + 1;
            int printCnt = Convert.ToInt32(cmbLine.SelectedItem);
            if (pageCnt * printCnt % 2 == 1 && selectedCustomer.printMode != Const.PRINT_MODE_ONE)
            {
                pageCnt = pageCnt + 1;
            }

            // 组装打印条码数据
            List<string> lstPrintBarCode = new List<string>();
            string plusCode = "";
            if (selectedCustomer.Id == 6)
            {
                plusCode = startCode.Substring(startCode.Length - 6, 5);
            }
            else
            {
                plusCode = startCode.Substring(startCode.Length - 5);
            }
            string headCode = "";
            if (selectedCustomer.Id == 6)
            {
                headCode = startCode.Substring(0, startCode.Length - 6);
            }
            else
            {
                headCode = startCode.Substring(0, startCode.Length - 5);
            }

            string printBarCode = headCode + plusCode;

            if (selectedCustomer.printMode == Const.PRINT_MODE_ONE)
            {
                for (int i = 1; i <= pageCnt; i++)
                {
                    for (int j = 1; j <= printCnt; j++)
                    {
                        lstPrintBarCode.Add(printBarCode);
                    }
                    if (selectedCustomer.autoPlusFlag)
                    {
                        plusCode = Convert.ToString(Convert.ToInt32(plusCode) + 1).PadLeft(5, '0');
                        printBarCode = headCode + plusCode;
                    }
                }
            }
            else
            {
                for (int i = 1; i <= pageCnt; i = i + 2)
                {
                    string nextBarCode = headCode + plusCode;
                    if (selectedCustomer.autoPlusFlag)
                    {
                        plusCode = Convert.ToString(Convert.ToInt32(plusCode) + 1).PadLeft(5, '0');
                        nextBarCode = headCode + plusCode;
                    }

                    for (int j = 1; j <= printCnt; j++)
                    {
                        lstPrintBarCode.Add(printBarCode);
                        lstPrintBarCode.Add(nextBarCode);
                    }

                    if (selectedCustomer.autoPlusFlag)
                    {
                        plusCode = Convert.ToString(Convert.ToInt32(plusCode) + 1).PadLeft(5, '0');
                        printBarCode = headCode + plusCode;
                    }
                }
            }

            // 开始打印
            int totalCnt = lstPrintBarCode.Count;
            int customerId = selectedCustomer.Id;
            if (selectedCustomer.printMode == Const.PRINT_MODE_ONE)
            {
                for (int i = 0; i < totalCnt; i++)
                {
                    PrintInfo printInfo = new PrintInfo();
                    printInfo.intDist = Convert.ToInt32(cmbData.SelectedItem);
                    printInfo.strCode = new string[] { lstPrintBarCode[i] };
                    if (selectedCustomer.inputLength == 17)
                    {
                        printInfo.narrow = "4";
                        printInfo.wide = "4";
                        BarCodePrint.PrtBarCode1AS17(printInfo);
                    }
                    else
                    {
                        printInfo.narrow = "5";
                        printInfo.wide = "5";
                        BarCodePrint.PrtBarCode1AS10(printInfo);
                    }
                }

            }
            else
            {
                for (int i = 0; i < totalCnt; i = i + 2)
                {
                    PrintInfo printInfo = new PrintInfo();
                    printInfo.intDist = Convert.ToInt32(cmbData.SelectedItem);
                    printInfo.strCode = new string[] { lstPrintBarCode[i], lstPrintBarCode[i + 1] };
                    if (selectedCustomer.printMode == Const.PRINT_MODE_TWO_LONG)
                    {
                        printInfo.narrow = "4";
                        printInfo.wide = "4";
                        printInfo.extral = Convert.ToString(selectedRow.Cells["meter_precision"].Value);

                        BarCodePrint.PrtBarCode2L(printInfo);
                    }
                    else
                    {
                        if (selectedCustomer.Id == 6)
                        {
                            printInfo.extral = "A";
                        }

                        if (selectedCustomer.Id == 2 || selectedCustomer.Id == 4 || selectedCustomer.Id == 8)
                        {
                            printInfo.narrow = "2";
                            printInfo.wide = "2";
                            BarCodePrint.PrtBarCode2SWithChar(printInfo);
                        }
                        else if (customerId == 1)
                        {
                            // 是否包含字符
                            if (Regex.IsMatch(lstPrintBarCode[i], @"[A-Za-z]{1}"))
                            {
                                // 有一个字母
                                printInfo.narrow = "2";
                                printInfo.wide = "2";
                                BarCodePrint.PrtBarCode2SWithChar(printInfo);
                            }
                            else
                            {
                                BarCodePrint.PrtBarCode2S(printInfo);
                            }

                        }
                        else if (customerId == 9)
                        {
                            printInfo.narrow = "2";
                            printInfo.wide = "2";
                            BarCodePrint.PrtBarCode2SL13(printInfo);
                        }
                        else
                        {
                            BarCodePrint.PrtBarCode2S(printInfo);
                        }
                        Console.WriteLine(printInfo.strCode[0] + "  " + printInfo.strCode[1]);

                    }
                }
            }
        }

        public int getErrorInformation(int error_code, out string message)
        {
            int result = 0;
            byte[] errorInfo = new byte[1024];
            PrintLab.PTK_GetErrorInfo(error_code, errorInfo, errorInfo.Length);
            message = Encoding.Default.GetString(errorInfo).Trim('\0');
            return result;
        }

        private byte[] E_UTF8(string data)
        {
            return Encoding.UTF8.GetBytes(data);
        }


        private void showError(string FunctionName, int error_code)
        {
            PrintLab.PTK_CloseUSBPort();
            var message = "";
            int result = getErrorInformation(error_code, out message);
            MessageBox.Show(FunctionName + ":" + message);
        }
        private void btnRepairPrint_Click(object sender, EventArgs e)
        {

            if (gridBH.SelectedRows.Count != 1)
            {
                MessageUtil.Error("请先选择一条数据作为参考打印类型！");
                return;
            }
            DataGridViewRow selectedRow = gridBH.SelectedRows[0];
            // 选择行的客户
            string customerName = Convert.ToString(selectedRow.Cells["customer_name"].Value);
            CustomerInfo selectedCustomer = null;
            if (dicCustomer.ContainsKey(customerName))
            {
                selectedCustomer = dicCustomer[customerName];
            }
            else
            {
                selectedCustomer = dicCustomer["普通"];
            }
            int customerId = selectedCustomer.Id;

            // 输入检查
            if (txtRepairCode1.Text.Length  != txtRepairCode2.Text.Length)
            {
                MessageUtil.Warn("两个补码的长度不一致");
                txtRepairCode1.Focus();
                return;
            }

            List<string> lstPrintBarCode = new List<string>();
            lstPrintBarCode.Add(txtRepairCode1.Text);
            lstPrintBarCode.Add(txtRepairCode2.Text);
            int totalCnt = lstPrintBarCode.Count;
                for (int i = 0; i < totalCnt; i += 2)
                {
                    //PrintInfo printInfo = new PrintInfo();
                    //printInfo.intDist = Convert.ToInt32(cmbData.SelectedItem);
                    //printInfo.strCode = new string[] { lstPrintBarCode[i] };
                    if (txtRepairCode1.Text.Length == 17)
                    {
                    //printInfo.narrow = "4";
                    //printInfo.wide = "4";
                    //BarCodePrint.PrtBarCode1AS17(printInfo);
                    /*
                      *mm:点，毫米转为点，由打印机分辨率决定
                      * 打印机分辨DPI=203时， mm=8
                      * 打印机分辨DPI=300时， mm=12
                      * 打印机分辨DPI=600时， mm=24
                    */
                    NewMethod(txtRepairCode1.Text, txtRepairCode2.Text, i, 1.5, 5.7, 13.5, 13.8, 33, 45, 2, 7, 4, 13, 14.5);
                }
                    else if(txtRepairCode1.Text.Length == 15)
                    {
                    //printInfo.narrow = "5";
                    //printInfo.wide = "5";
                    //BarCodePrint.PrtBarCode1AS10(printInfo);
                    NewMethod(txtRepairCode1.Text, txtRepairCode2.Text, i,2.5, 5.7, 13.5, 13.8, 34, 45, 2, 7, 4, 14, 14.5);
                    //NewMethod(txtRepairCode1.Text, txtRepairCode2.Text, i,2.5, 5.7, 14.5, 13.8, 34, 45.5, 2, 7, 4, 14, 14.5);
                }
                    else if (txtRepairCode1.Text.Length == 12)
                    {
                    //printInfo.narrow = "5";
                    //printInfo.wide = "5";
                    //BarCodePrint.PrtBarCode1AS10(printInfo);
                    NewMethod(txtRepairCode1.Text, txtRepairCode2.Text, i, 1.2, 5.7, 13.5, 13.8, 32.5, 45, 3, 7, 4, 20, 14.5);
                }
                else if (txtRepairCode1.Text.Length == 13)
                {
                    //printInfo.narrow = "5";
                    //printInfo.wide = "5";
                    //BarCodePrint.PrtBarCode1AS10(printInfo);
                    NewMethod(txtRepairCode1.Text, txtRepairCode2.Text, i, 3.5, 5.7, 14, 13.8, 34.5, 45, 2, 7, 4, (int)15.5, 14.5);
                }
                else
                    {
                    NewMethod(txtRepairCode1.Text, txtRepairCode2.Text, i, 0.3, 5.7, 12.5, 13.8, 33.5, 46, 2, 7, 4, 20, 14.5);
                    }
                }

        }

        private void NewMethod(string lstPrintBarCode ,string code2, int i, double xOne, double yOne, double xOneF, double yOneF, double xTwo, double xTwoF, int widthK, int widthZ, int sizeHeight, int sizeWidth, double height)
        {
            uint mm = 12;
            int result = 0;
            var message = "";
            /*连接打印机*/
            result = PrintLab.PTK_OpenUSBPort(255);
            if (result != 0)
            {
                result = getErrorInformation(result, out message);
                MessageBox.Show(message);
                return;
            }
            /*函数返回值*/
            int result_printing = 0;
            /*横坐标偏移,设置标签整体横向移动位置*/
            int offset_X = 60;
            /*纵坐标偏移，设置标签整体纵向移动位置*/
            int offset_Y = 0;
            /*清空缓存*/
            result_printing = PrintLab.PTK_ClearBuffer();
            if (result_printing != 0) { showError("PTK_ClearBuffer", result_printing); return; }
            /*设置打印黑度 取值范围 0-20*/
            result_printing = PrintLab.PTK_SetDarkness(10);
            if (result_printing != 0) { showError("PTK_SetDarkness", result_printing); return; }
            /*设置打印速度*/
            result_printing = PrintLab.PTK_SetPrintSpeed(4);
            if (result_printing != 0) { showError("PTK_SetPrintSpeed", result_printing); return; }
            /*设置打印方向*/
            result_printing = PrintLab.PTK_SetDirection('B');
            if (result_printing != 0) { showError("PTK_SetDirection", result_printing); return; }
            /*设置标签高度、间隙及偏移*/
            result_printing = PrintLab.PTK_SetLabelHeight((uint)(height * mm), 0, 2 * mm, false);
            if (result_printing != 0) { showError("PTK_SetLabelHeight", result_printing); return; }
            /*设置标签宽度，一定要准确，否则会导致打印内容位置不准确*/
            result_printing = PrintLab.PTK_SetLabelWidth(60 * mm);
            if (result_printing != 0) { showError("PTK_SetLabelWidth", result_printing); return; }
            /*打印一维码 此示例为Code128码*/
            result_printing = PrintLab.PTK_DrawBarcode((uint)(xOne * mm), (uint)(yOne * mm + offset_Y), 0, "1", (uint)widthK, (uint)widthZ, 6 * mm, 'N', E_UTF8(lstPrintBarCode));//打印一维码
            if (result_printing != 0) { showError("PTK_DrawBarcode", result_printing); return; }
            /* 打印条码下方文字*/
            result_printing = PrintLab.PTK_DrawText_TrueType((uint)(xOneF * mm), (uint)(yOneF * mm), 50, (uint)sizeWidth, E_UTF8("微软雅黑"), 5, 400, false, false, false, E_UTF8(lstPrintBarCode));
            if (result_printing != 0) { showError("PTK_DrawText_TrueType", result_printing); return; }
            result_printing = PrintLab.PTK_DrawBarcode((uint)(xTwo * mm), (uint)(yOne * mm + offset_Y), 0, "1", (uint)widthK, (uint)widthZ, 6 * mm, 'N', E_UTF8(code2));//打印一维码
            if (result_printing != 0) { showError("PTK_DrawBarcode", result_printing); return; }
            /* 打印条码下方文字*/
            result_printing = PrintLab.PTK_DrawText_TrueType((uint)(xTwoF * mm), (uint)(yOneF * mm), 50, (uint)sizeWidth, E_UTF8("微软雅黑"), 5, 400, false, false, false, E_UTF8(code2));
            if (result_printing != 0) { showError("PTK_DrawText_TrueType", result_printing); return; }
            /*打印，必须要执行这一行，否则不会打印，打印多张标签时每张标签后面都需要加它*/
            result_printing = PrintLab.PTK_PrintLabel(1, 1);
            if (result_printing != 0) { showError("PTK_PrintLabel", result_printing); return; }
            /*断开打印机连接*/
            PrintLab.PTK_CloseUSBPort();
        }




        ///  客户数据
        /// </summary>
        private void createCustomerInfo()
        {
            dicCustomer = new Dictionary<string, CustomerInfo>();

            CustomerInfo normalInfo = new CustomerInfo();
            normalInfo.Id = 1;
            normalInfo.Name = "普通";
            normalInfo.comment = "12位纯数字条码（第7位可以是字母）";
            normalInfo.inputLength = 12;
            normalInfo.printMode = Const.PRINT_MODE_TWO_SHORT;
            normalInfo.printCnt = 1;
            dicCustomer.Add(normalInfo.Name, normalInfo);

            normalInfo = new CustomerInfo();
            normalInfo.Id = 11;
            normalInfo.Name = "铜陵港华";
            normalInfo.comment = "12位纯数字条码";
            normalInfo.inputLength = 12;
            normalInfo.printMode = Const.PRINT_MODE_TWO_SHORT;
            normalInfo.printCnt = 2;
            dicCustomer.Add(normalInfo.Name, normalInfo);

            normalInfo = new CustomerInfo();
            normalInfo.Id = 12;
            normalInfo.Name = "淮北华润";
            normalInfo.comment = "12位纯数字条码";
            normalInfo.inputLength = 12;
            normalInfo.printMode = Const.PRINT_MODE_TWO_SHORT;
            normalInfo.printCnt = 2;
            dicCustomer.Add(normalInfo.Name, normalInfo);

            normalInfo = new CustomerInfo();
            normalInfo.Id = 13;
            normalInfo.Name = "济南港华";
            normalInfo.comment = "12位纯数字条码";
            normalInfo.inputLength = 12;
            normalInfo.printMode = Const.PRINT_MODE_TWO_SHORT;
            normalInfo.printCnt = 3;
            dicCustomer.Add(normalInfo.Name, normalInfo);

            CustomerInfo syrqInfo = new CustomerInfo();
            syrqInfo.Id = 2;
            syrqInfo.Name = "沈阳燃气";
            syrqInfo.comment = "LB或RB开头的11或12位条码";
            syrqInfo.inputLength = 12;
            syrqInfo.printCnt = 2;
            syrqInfo.printMode = Const.PRINT_MODE_TWO_SHORT;
            dicCustomer.Add(syrqInfo.Name, syrqInfo);

            CustomerInfo njghInfo = new CustomerInfo();
            njghInfo.Id = 3;
            njghInfo.Name = "南京港华";
            njghInfo.comment = "17位纯数字条码";
            njghInfo.inputLength = 17;
            njghInfo.printMode = Const.PRINT_MODE_ONE;
            njghInfo.printCnt = 2;
            dicCustomer.Add(njghInfo.Name, njghInfo);

            CustomerInfo ncInfo = new CustomerInfo();
            ncInfo.Id = 4;
            ncInfo.Name = "南昌";
            // 2020.08.26 修改为P开头的12位条码
            //ncInfo.comment = "Y开头的13位条码";
            //ncInfo.inputLength = 13;
            ncInfo.comment = "P开头的12位条码";
            ncInfo.inputLength = 12;
            ncInfo.printMode = Const.PRINT_MODE_TWO_SHORT;
            ncInfo.printCnt = 1;
            dicCustomer.Add(ncInfo.Name, ncInfo);

            CustomerInfo jkInfo = new CustomerInfo();
            jkInfo.Id = 5;
            jkInfo.Name = "金卡";
            jkInfo.comment = "16位纯数字条码";
            jkInfo.inputLength = 16;
            jkInfo.printMode = Const.PRINT_MODE_TWO_LONG;
            jkInfo.printCnt = 1;
            dicCustomer.Add(jkInfo.Name, jkInfo);

            CustomerInfo jcfxjInfo = new CustomerInfo();
            jcfxjInfo.Id = 6;
            jcfxjInfo.Name = "积成氟橡胶";
            jcfxjInfo.comment = "12位纯数字条码，后面加A（不计入条形码）";
            jcfxjInfo.inputLength = 13;
            jcfxjInfo.printMode = Const.PRINT_MODE_TWO_SHORT;
            jcfxjInfo.printCnt = 1;
            dicCustomer.Add(jcfxjInfo.Name, jcfxjInfo);

            CustomerInfo ghxfInfo = new CustomerInfo();
            ghxfInfo.Id = 7;
            ghxfInfo.Name = "港华先锋批次";
            ghxfInfo.comment = "YX开头的10位条码";
            ghxfInfo.inputLength = 10;
            ghxfInfo.printMode = Const.PRINT_MODE_ONE;
            ghxfInfo.printCnt = 1;
            ghxfInfo.autoPlusFlag = false;
            dicCustomer.Add(ghxfInfo.Name, ghxfInfo);

            CustomerInfo ldInfo = new CustomerInfo();
            ldInfo.Id = 8;
            ldInfo.Name = "娄底";
            ldInfo.comment = "L或R开头的13位条码";
            ldInfo.inputLength = 13;
            ldInfo.printMode = Const.PRINT_MODE_TWO_SHORT;
            ldInfo.printCnt = 1;
            dicCustomer.Add(ldInfo.Name, ldInfo);

            CustomerInfo wxInfo = new CustomerInfo();
            wxInfo.Id = 9;
            wxInfo.Name = "威星";
            wxInfo.comment = "2开头的13位条码";
            wxInfo.inputLength = 13;
            wxInfo.printMode = Const.PRINT_MODE_TWO_SHORT;
            wxInfo.printCnt = 1;
            dicCustomer.Add(wxInfo.Name, wxInfo);
        }



    }
}



